package com.roc.web.action.settlemorg;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

@SuppressWarnings("serial")
public class SettlementOrgPaySearchCondition extends BaseSearchCondition {
	private String phone;
	private String accountNo;
	private String acctNo;
	private String applyDateMin;
	private String applyDateMax;
	private String org;
	private String setDateMin;
	private String setDateMax;
	private String status;
	private String merchantsn;
	private String id;
	private String type;
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		
		if(Constance.isNotEmpty(phone)){
			filedBeanList.add(new WhereHQLFieldBean("s.mobile_no",phone.trim(),"=",false));
		}
		if(Constance.isNotEmpty(accountNo)){
			filedBeanList.add(new WhereHQLFieldBean("s.account_id",accountNo.trim(),"=",false));
		}
		if(Constance.isNotEmpty(acctNo)){
			filedBeanList.add(new WhereHQLFieldBean("s.pye_acct_no",acctNo.trim(),"=",false));
		}
		if(Constance.isNotEmpty(applyDateMin)){
			filedBeanList.add(new WhereHQLFieldBean("s.trans_dt", applyDateMin.trim(),">=", false));
		}
		if(Constance.isNotEmpty(applyDateMax)){
			filedBeanList.add(new WhereHQLFieldBean("s.trans_dt", applyDateMax.trim(),"<=", false));
		}		
		if(Constance.isNotEmpty(org)){
			filedBeanList.add(new WhereHQLFieldBean("s.ins_id_cd", org.trim(),"=", false));
		}
		if(Constance.isNotEmpty(setDateMin)){
			filedBeanList.add(new WhereHQLFieldBean("s.remark6", setDateMin.trim(),">=", false));
		}
		if(Constance.isNotEmpty(setDateMax)){
			filedBeanList.add(new WhereHQLFieldBean("s.remark6", setDateMax.trim(),"<=", false));
		}
		if(Constance.isNotEmpty(status)){
			filedBeanList.add(new WhereHQLFieldBean("s.status", status.trim(),"=", false));
		}
		if(Constance.isNotEmpty(merchantsn)){
			filedBeanList.add(new WhereHQLFieldBean("s.remark1", merchantsn.trim(),"=", false));
		}
		if(Constance.isNotEmpty(id)){
			filedBeanList.add(new WhereHQLFieldBean("s.key_rsp",id.trim(),"=", false));
		}		
		if(Constance.isNotEmpty(type)){
			filedBeanList.add(new WhereHQLFieldBean("s.ma_trans_cd", type.trim(),"=", false));
		}
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append("select count(*) from apstfr.tbl_ins_pay_detail s where 1=1 ");
		return sb.toString();
	}

	@Override
	protected String getSearchHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append("select s.trans_dt,s.key_rsp,s.ma_trans_cd,s.ins_id_cd,s.account_id,s.mobile_no,s.total_count,s.pay_amt,s.total_fee,s.pye_acct_no,s.pye_acct_nm,s.status,s.remark1,s.remark6,s.pye_bank_nm,s.tran_seq from apstfr.tbl_ins_pay_detail s where 1=1 ");
		return sb.toString();
	}

	@Override
	protected String getOrderPartOfHQL() {
		return "order by s.rec_crt_ts desc";
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getAccountNo() {
		return accountNo;
	}

	public void setAccountNo(String accountNo) {
		this.accountNo = accountNo;
	}

	public String getAcctNo() {
		return acctNo;
	}

	public void setAcctNo(String acctNo) {
		this.acctNo = acctNo;
	}

	public String getApplyDateMin() {
		return applyDateMin;
	}

	public void setApplyDateMin(String applyDateMin) {
		this.applyDateMin = applyDateMin;
	}

	public String getApplyDateMax() {
		return applyDateMax;
	}

	public void setApplyDateMax(String applyDateMax) {
		this.applyDateMax = applyDateMax;
	}

	public String getOrg() {
		return org;
	}

	public void setOrg(String org) {
		this.org = org;
	}

	public String getSetDateMin() {
		return setDateMin;
	}

	public void setSetDateMin(String setDateMin) {
		this.setDateMin = setDateMin;
	}

	public String getSetDateMax() {
		return setDateMax;
	}

	public void setSetDateMax(String setDateMax) {
		this.setDateMax = setDateMax;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getMerchantsn() {
		return merchantsn;
	}

	public void setMerchantsn(String merchantsn) {
		this.merchantsn = merchantsn;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
	
	
}
